/*
 * Copyright (C) 2015-2016 Actor LLC. <https://actor.im>
 */

.sidebar {
  position: relative;

  overflow: visible;

  width: $sidebar-width;
  min-width: $sidebar-width;
  height: 100%;

  color: $sidebar-text-color;
  background-color: $dusky-blue;

  &__header {
    user-select: none;
    transition: background $default-transition-duration $default-transition-timing;
    &__user {
      height: $sidebar-header-height;
      padding: 2px 14px;

      .avatar {
        margin: 18px 10px 18px 0;
      }

      &__name {
        font-size: 16px;
        font-weight: 500;
        line-height: 22px;

        margin: 19px 0;

        vertical-align: middle;

        color: white;

        @include text-elipsis();
      }
      .dropdown__button {
        width: 24px;
        height: 24px;
        margin: 18px 0;

        transition: transform $default-transition-duration $default-transition-timing;
        vertical-align: middle;

        color: rgba(255, 255, 255, .65);
      }
    }

    .dropdown--opened {
      .dropdown__button {
        transition: transform $default-transition-duration $default-transition-timing;

        background-color: transparent !important;
        box-shadow: none !important;
      }
    }
    .dropdown__menu {
      top: 47px;

      min-width: 255px;
      margin-right: -67px;
    }

    &:hover {
      //background-color: rgba($baby-blue,.2);
      background-color: rgba($baby-blue, .12);
    }
    &--clickable {
      cursor: pointer;
    }
    &--opened {
      background-color: rgba($baby-blue, .2) !important;
      .dropdown__button {
        transform: scale(1, -1);

        color: white;

        backface-visibility: hidden;
      }
    }
  }

  &__list {
    font-weight: 500;
    line-height: 24px;

    overflow: auto;

    margin: 0;
    padding: 0 0 10px;

    list-style: none;
    &__title {
      font-size: 15px;
      font-weight: 500;
      line-height: 32px;

      padding: 0 14px;

      cursor: default;
      text-transform: uppercase;

      color: rgba(white, .6);

      a {
        cursor: pointer;
        transition: 200ms;
        border-bottom: 1px dotted rgba(white, .6);
        line-height: 16px;
        display: inline-block;
        &:hover {
          color: white;
          border-bottom: 1px dotted white;
        }
      }

      &__icon {
        font-size: 22px;
        line-height: 32px;

        cursor: pointer;
        transition: 200ms;

        color: rgba(white, .3);
        &:hover {
          transform: rotate(90deg);

          color: white;
        }
      }
    }
    &__item {
      font-size: 15px;

      padding: 5px 14px;
      margin: 0;
      text-decoration: none;

      cursor: pointer;
      vertical-align: middle;
      //transition: color $default-transition-duration $default-transition-timing;

      color: rgba(white, .6);
      .avatar {
        cursor: pointer;
        margin: 0 10px 0 0;
        //transition: filter $default-transition-duration $default-transition-timing;

        vertical-align: top;

        filter: saturate(.4) contrast(.6);
      }
      .title {
        @include text-elipsis();
        @include no-select();
        cursor: pointer !important;
        .emoji-outer {
          width: 20px;
          height: 20px;
        }
      }
      .counter {
        font-size: 14px;
        font-weight: 500;
        line-height: 24px;

        display: inline-block;

        box-sizing: border-box;
        min-width: 24px;
        height: 24px;
        margin: 0 0 0 2px;
        padding: 0 4px;

        text-align: center;

        color: white;
        border-radius: 12px;
        background-color: $coral;

        @include no-select();
      }
      .delete {
        font-size: 18px;
        line-height: 24px;

        display: none;

        margin-right: 3px;
        margin-left: 6px;

        color: rgba(white, .6);
        &:hover {
          color: white;
        }
      }
      .favorite,
      .archive {
        height: 24px;
        text-align: center;
        display: none;
        .icon {
          vertical-align: top;
          font-size: 20px;
          line-height: 24px;
          color: rgba(white, .5);
          &:hover {
            color: white;
          }
        }
      }
      .archive {
        &--in-progress,
        &--failure {
          display: block;
          .icon {
            color: white;
          }
        }
      }

      &:hover {
        color: white;
        background-color: rgba($baby-blue, .12);
        box-shadow: none;
        .avatar {
          filter: none;
        }
        .counter {
          // display: none;
        }
        .archive,
        .delete,
        .favorite {
          display: block;
        }
      }
      &--active {
        color: white;
        background-color: $dark-sky-blue !important;
        .avatar {
          filter: none;
        }
      }
      &--unread {
        opacity: 1;
        color: white;
        .avatar {
          filter: none;
        }
      }
    }

    &:last-child {
      margin-bottom: 0;
    }

    &--recent {
      position: absolute;
      top: $toolbar-height;
      right: 0;
      bottom: 64px;
      left: 0;
    }
    &--contacts {
      position: absolute;
      top: 0;
      right: 0;
      bottom: 64px;
      left: 0;
      .title {
        line-height: 32px;
      }
    }
    &--empty {
      // min-height: 100px;
      @include no-select();
      .sidebar__list__item {
        text-align: center;
        padding: 16px;
        cursor: default;
        font-weight: 400;
        position: relative;
        .stem {
          position: absolute;
          right: 20px;
          top: 6px;
          height: 20px;
          overflow: hidden;
          transform: rotate(160deg);
          width: 24px;
          &:after {
            content: '';
            display: block;
            width: 50px;
            height: 50px;
            border: 1px solid rgba(white, .6);
            border-radius: 360px;
          }
        }
        .button {
          margin-top: 14px;
        }
        &:hover {
          color: rgba(white, 0.6);
          background-color: transparent;
        }
      }
    }
  }

  &__recent {
    position: absolute;
    top: $sidebar-header-height;
    bottom: $sidebar-footer-height;
    width: 100%;
    &__empty {
      font-size: 14px;
      font-weight: 500;

      height: 200px;
      padding: 16px;

      color: rgba(white, .8);

      @include no-select();
      p {
        margin: 0;
        padding-bottom: 8px;
      }
      a {
        cursor: pointer;

        color: $dark-sky-blue;
      }
    }

    .scroll-wrapper {
      .ss-scroll {
        right: -2px;
        width: 4px;
        opacity: 1 !important;
        &:hover,
        &:active {
          width: 8px;
          right: -4px;
        }
      }
    }
    &__unread {
      position: absolute;
      width: 100%;
      background-color: $coral;
      height: 4px;
      left: 0;
      z-index: 2;
      transition: 100ms;
      overflow: hidden;
      .material-icons {
        font-size: 16px;
        position: absolute;
        left: 50%;
        margin-left: -10px;
        width: 20px;
      }
      &:hover {
        cursor: pointer;
        height: 16px;
      }
      &--above {
        top: 0;
        .material-icons {
          bottom: 0;
        }
      }
      &--below {
        bottom: 0;
        .material-icons {
          top: 0;
        }
      }
    }

    footer {
      padding: 0 16px 16px;
    }
  }

  &__quick-search {
    position: absolute;
    bottom: 0;

    box-sizing: border-box;
    width: 100%;
    height: $sidebar-footer-height;

    @include no-select();

    a {
      font-size: 14px;
      font-weight: 500;
      line-height: $sidebar-footer-height;

      display: block;

      width: 100%;
      height: 50px;

      cursor: pointer;
      text-align: center;
      text-transform: uppercase;

      color: rgba(white, .4);
      background-color: rgba(black, .1);
      &:hover {
        color: white;
        background-color: rgba(black, .15);
      }
    }
    .icon-holder {
      position: relative;

      display: inline-block;

      height: 100%;

      vertical-align: middle;
    }
    span {
      display: inline-block;

      vertical-align: middle;
    }
    .material-icons {
      position: absolute;
      top: 13px;
      right: 2px;
    }
  }
}
